<div class="uk-layui-form">
	<form class="layui-form uk-form" action="/admin/multitenant/add/save.html">
	  <div class="layui-form-item">
	    <label class="layui-form-label">租户名：</label>
	    <div class="layui-input-inline">
	      <input type="text" name="tenantname" required lay-verify="required" placeholder="请输入租户名" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">租户ID：</label>
	    <div class="layui-input-inline">
	      <input type="text" name="tenantcode" id="tenantcode" required lay-verify="required|tenantcode" placeholder="请输入租户ID" autocomplete="off" class="layui-input">
	    </div>
	  </div>

		<div class="layui-form-item">
			<label class="layui-form-label">文本坐席数量：</label>
			<div class="layui-input-inline">
				<input type="text" name="agentnum" required lay-verify="required|number" placeholder="-1无限制" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">呼叫中心坐席数量：</label>
			<div class="layui-input-inline">
				<input type="text" name="callcenteragentnum"  required lay-verify="required|number" placeholder="-1无限制" autocomplete="off" class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">电销机器人并发数量：</label>
			<div class="layui-input-inline">
				<input type="text" name="robotagentnum"  value="${tenant.robotagentnum!0}" required lay-verify="required|number" placeholder="-1无限制" autocomplete="off" class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">授权模块：</label>
			<div class="layui-input-inline">
				<textarea name="models" placeholder="授权模块 ，号分隔 （contacts,weixin,workorders,xiaoe,callcenter,sales,calloutai,qc)" lay-verify="required" class="layui-textarea">${tenant.models!''}</textarea>
			</div>
		</div>

	  <div class="layui-form-button">
	    <div class="layui-button-block">
	      <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
	      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
	    </div>
	  </div>
	</form>
</div>
 
<script type="text/javascript">
//Demo
layui.use('form', function(){
  var form = layui.form;
  form.render(); //更新全部
  form.verify({
	  repass: function(value){
	    if(value != $('#password').val()){
	      return '两次输入的密码不一致，请确认';
	    }
	  },
	  tenantcode: function(value){
		var text = /^[0-9a-zA-Z]+$/
		console.log($('#tenantcode').val());
		if(!text.test($('#tenantcode').val())){
	      return '租户ID只能为英文、数字 和两者组合！';
	    }
	  }
	});  
 	form.on('switch(bindext)', function(data){
		if(data.elem.checked){
			$('#bindext_tip').show();
		}else{
			$('#bindext_tip').hide();
		}
	}); 
 	form.on('switch(agent)', function(data){
		if(data.elem.checked){
			$('.max_tip').show();
		}else{
			$('.max_tip').hide();
		}
	}); 
});
</script>